#include "SimpleFactory.h"
IOperation* OperationFactory::CreateOperation(OPERATION oper)
{
	IOperation* pOperation = NULL;

	switch(oper)
	{
		case OPERA_ADD:
			pOperation = new OperationAdd;
			break;
		case OPERA_SUB:
			pOperation = new OperationSub;
			break;
		case OPERA_MUL:
			pOperation = new OperationMul;
			break;
	}

	return pOperation;
}

int main()
{
	IOperation *pOper;

	pOper = OperationFactory::CreateOperation(OperationFactory::OPERA_ADD); 
	if(pOper == NULL)
		return -1;

	cout << "result:"<< pOper->GetResult(3,4) <<endl;

	delete pOper;
	
	return 0;
}
